package com.erpx.api.goods;

import com.erpx.api.WdtClient;
import com.erpx.api.param.SuiteCreateParam;
import com.erpx.api.param.SuiteDetailCreateParam;
import com.erpx.utils.JsonUtils;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.erpx.api.CommonConstants;
public class SuiteCreateService {
    public static void suitesPush() throws Exception {
        WdtClient client = new WdtClient(CommonConstants.sid, CommonConstants.appkey, CommonConstants.appSecret, CommonConstants.baseUrl);

        Map<String, String> params = new HashMap<String, String>();
        List<SuiteCreateParam> list = new ArrayList<>();
        SuiteCreateParam suiteCreateParam = new SuiteCreateParam();
        suiteCreateParam.setSuiteNo("SU202408050001");
        suiteCreateParam.setSuiteName("商城测试组合装");
        SuiteDetailCreateParam detailCreateParam = new SuiteDetailCreateParam();
        detailCreateParam.setSpecNo("SPE20240805001");
        detailCreateParam.setNum("2");
        detailCreateParam.setRatio("1");
        List<SuiteDetailCreateParam> suiteDetailList = new ArrayList<>();
        suiteDetailList.add(detailCreateParam);
        suiteCreateParam.setSuiteDetailList(suiteDetailList);
        list.add(suiteCreateParam);
        params.put("suite_info", JsonUtils.serialize(list));
        try {
            String response = client.execute("suites_push.php", params);
            System.out.println(response);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}
